//
//  DGGPullDownMenuToolBar.h
//  demo
//  下拉菜单工具条
//  Created by 周家民 on 2020/8/11.
//  Copyright © 2020 mac. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@class DGGPullDownMenuToolBar;

@protocol DGGPullDownMenuToolBarDataSource <NSObject>

@required
- (NSInteger)numberOfTitle:(DGGPullDownMenuToolBar *)toolBar;

- (UIView *)toolBar:(DGGPullDownMenuToolBar *)toolBar contentViewForIndex:(NSInteger)index;

@optional

- (nullable NSString *)toolBar:(DGGPullDownMenuToolBar *)toolBar titleForIndex:(NSInteger)index;
- (UIView *)toolBar:(DGGPullDownMenuToolBar *)toolBar titleViewForIndex:(NSInteger)index;

@end

@interface DGGPullDownMenuToolBar : UIView

/// 菜单标题字体对象，默认系统字体，字号14
@property (nonatomic, strong) UIFont *titleFont;

/// 默认状态下的菜单标题文字颜色
@property (nonatomic, strong) UIColor *normalTitleColor;

/// 选中状态下的菜单标题文字颜色
@property (nonatomic, strong) UIColor *selectedTitleColor;

/// 蒙板视图的透明度，范围0~1，默认0.3
@property (nonatomic, assign) CGFloat mbAlpha;

/// 数据源
@property (nonatomic, weak) id<DGGPullDownMenuToolBarDataSource> dataSource;

/// 将下拉菜单工具条绑定到指定view
/// @param view view
/// @param frame frame
- (void)bindOnView:(UIView *)view frame:(CGRect)frame;

/// 展开指定index的下拉菜单
/// @param index 下标
- (void)openForIndex:(NSInteger)index animate:(BOOL)animate;

/// 折叠所有
- (void)foldWithAnimate:(BOOL)animate;

/// 重新加载数据源并渲染视图
- (void)reloadData;

@end

NS_ASSUME_NONNULL_END
